<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@ page import="java.util.*"%>
<%@ page import="com.F09.dao.*"%>
<%
	OrgUserDAO dao = new OrgUserDAO();
	try{
		List list = dao.selectByOrgLift();
%>
<HTML>
<HEAD>
<META http-equiv=Pragma content=no-cache>
<META http-equiv=Cache-Control content=no-cache>
<META http-equiv=Expires content=0>
<link  href="../../style/css/main.css" rel="stylesheet" type="text/css"/>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache"> 
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache"> 
<META HTTP-EQUIV="Expires" CONTENT="0"> 
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<TITLE> F0901Left </TITLE>
<script language="JavaScript" src="../../style/scripts/tree.js" type="text/javascript"></script>
<script language="JavaScript" src="../../style/scripts/help.js" type="text/javascript"></script>
<!--以下是右键菜单的列表-->
<script language='javascript'>
   var nodePopup = new Array;
   nodePopup.push(new TreePopup('添加子节点','javascript:addChild(currentNode);'));
   //nodePopup.push(new TreePopup('修改本节点','javascript:modifyNode(currentNode);'));
   nodePopup.push(new TreePopup('删除本节点','javascript:deleteNode(currentNode);'));
   popups['nodePopup'] = nodePopup;
</script>
<!--以下是右键菜单的列表-->
<script language='javascript'>
  //以下是添加子节点的代码



  function addChild(node){
    parent.document.createResource.UgmConstantsParentId.value=node.nodeId;
	parent.document.createResource.root.value='****';
    toggleDialogBox('createResource',150,300, node.nodeName,1,1);
  }
  //以下是添加本节点的代码



  function modifyNode(node){
    window.parent.document.modifyResource.UgmConstantsModifyNodeId.value=node.nodeId;
    window.parent.document.modifyResource.UgmConstantsModifyNodeName.value=node.nodeName;
	window.parent.document.modifyResource.root.value='****';
	if(node.nodeDesc!=null && node.nodeDesc!=undefined){
		window.parent.document.modifyResource.UgmConstantsModifyNodeDesc.value=node.nodeDesc;
	}
    toggleDialogBox('modifyResource',150,300, node.nodeName,1,1);
  }
  // delete a node and all of its associated content and child nodes
  function deleteNode(node){
      if(confirm('是否删除？注意：本次操作将删除本节点及下属所有子节点')){
      window.parent.document.DeletedNodeForm.UgmConstantsDeletedNodeId.value = node.nodeId;
	  window.parent.document.DeletedNodeForm.root.value='****';
      window.parent.document.DeletedNodeForm.submit();
      }
   }
  //以下代码是点击了某一个节点



  function selectNode(node){
	window.parent.document.SelectNodeForm.ID.value = node.nodeId;
	window.parent.document.SelectNodeForm.submit();
	setSelectedNode(node.nodeId);
  }
</script>
<script language='javascript'>
  var beforeSelectedNodeBgcolor = '#EEEEEE';  
  var currentNodeRootId = '';
  var currentNodeLevel = '';      //选择的node的级次



  
  //以下代码是点击了某一个节点(非根节点)被调用



  function selectNode(node){
	currentNodeLevel = node.nodeLevel;
	//if (node.parentid != "a"){
		window.parent.document.all.Frame2.src="<%=request.getContextPath()%>/pages/F09/F0901RightUser.do?operationType=query&type=10&ORGID="+node.functionid+"&ORGNAME="+node.orgname;
	//}
	setSelectedNode(node.nodeId);
	
	beforeSelectedNodeBgcolor = '#EEEEEE';
	if(node.nodeIsCurrent == '1'){
		beforeSelectedNodeBgcolor = CURRENT_COLOR;
	}
  }
  //以下代码是点击根节点被调用



  function selectRoot(){
	//selectedNodeId = '0';
	//window.parent.parentAction('0');
	//setSelectedNode('0');
  }
  
    
</script>
<style type="text/css">
.tree_current
  {
    font-family: Tahoma, Geneva, Arial, Helvetica, sans-serif;
    font-size: 11px;
    color: #000000;
    text-decoration: none;
    background-color: '#99CC33';
  }
</style>
</HEAD>
<BODY class="application-body"  style=" overflow:auto;
    margin-top:                     0px;
	margin-left:                     0px;
	margin-right:                     0px;
    scrollbar-face-color:        buttonface;	
    scrollbar-highlight-color:  #ffffff;
    scrollbar-3dlight-color:    #ffffff;
    scrollbar-darkshadow-color: darkgray;
    scrollbar-shadow-color:     white;
    scrollbar-arrow-color:      #000000;
    scrollbar-track-color:      #f1f1f1;
	BORDER-RIGHT: #C3C3C3 1px solid;" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
  <!--以下是弹出右键菜单的界面-->
<div id="popupPlaceholder" style="position: absolute;visibility: hidden;">&nbsp;</div>
  <!--以下是弹出窗口的背景，用来覆盖整个窗口，使树窗口无法被激活-->
  <!--<div id="dialogBackgroundDiv" class="dialogBackgroundDiv">&nbsp;</div>
  <!-- Displays a cursor when the page is getting submitted or updated（等待界面） -->
<div id="waitDiv" class="waiting">&nbsp;</div>
<div style="width:100%; height:expression(document.body.clientHeight); overflow:auto;">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" height="100%">
	<tr>
 		<td width="5" class="boxBodyLeftBorderOff" nowrap="nowrap"></td>
		<td class="boxBodyMiddleOff" valign="top" style="width:99%;height:100%;">
<!-- create the javascript tree here -->     
<script language="JavaScript">setLocal(true);</script>

<!--节点树的生成-->
<script language='javascript'>
if(document.all) {
   document.write('<div style="width:100%; white-space:nowrap; overflow:atuo;">');
} else {
   document.write('<table width="100%"><tr><td nowrap>');
}
    setBaseDirectory('../../style/images/');
    setTaxonomyDelimeter('.');
{
	_a = new TreeNode('0', null, '用户管理', 'javascript:selectRoot();', '../../frame/tree/image/img/base0.gif', '../../frame/tree/image/img/base0.gif', null, null, false, true,false);
    _a.treeId='ugmTree';
    _a.nonSelectable='true';
	<%
	  if(list!=null){
		  for(int i=0; i<list.size(); i++){				
			Map map = (Map) list.get(i);
			
				String functionid = (String) map.get("ORGID");
				String parentid = (String) map.get("PARENTID");
				String seq=(String)map.get("SEQ");
				if("1".equals(seq)){
				    parentid="a";
				}
				String name = (String) map.get("NAME");
				HttpSession  se  = request.getSession();//
				se.setAttribute("orgname",name);
				String nextparentid="";
				String img_1="page0.gif";
				String img_2="page0.gif";
				if(i<list.size()-1){
				    nextparentid=((Map)(list.get(i+1))).get("PARENTID").toString();
				}
				String flag="false";
				if(functionid.equals(nextparentid)){
				    flag="true";
				    img_1="folder0.gif";
				    img_2="folderopen0.gif";
				}
				StringBuffer treenode =new StringBuffer(); 
				treenode.append("_"+functionid+" = new TreeNode('"+functionid+"',_"+parentid+",'"+name+"','javascript:selectNode(currentNode)', '../../frame/tree/image/img/"+img_2+"', '../../frame/tree/image/img/"+img_1+"', null, null, false,"+flag+",false);");
				treenode.append("_"+functionid+".treeId='ugmTree';");
				treenode.append("_"+functionid+".nonSelectable='true';");
				treenode.append("_"+functionid+".nodeDesc='';");
				treenode.append("_"+functionid+".nodeLevel='1';");
				treenode.append("_"+functionid+".nodeIsCurrent='0';");
				treenode.append("_"+functionid+".functionid='"+functionid+"';");
				treenode.append("_"+functionid+".parentid='"+parentid+"';");
				treenode.append("_"+functionid+".orgname='"+name+"';");
				out.println(treenode);
		
		}
	}
	%>
	createTree(_a);
	if(selectedNodeId!=null)
	{
		var n = getNode(selectedNodeId);
		if(n!=null)
			selectNode(n);
	}

}
if(document.all) {
   document.write('</div>');
} else {
   document.write('</td></tr></table>');
}
</script>
</td>
</tr>
</table>
</div>
  <!--以下是展开/折叠节点树的Form，仅当setLocal为false时有效-->
  <form method="post" name="HierarchyManagementForm">
      <input type="hidden" name="action" value="" />
      <input type="hidden" name="nodeId" value="" />
  </form>
  <!--以下是刷新节点树的Form-->
  <form method="post" name="invalidateUgmTreeCache">
        <input type="hidden" name='action' value="invalidateUgmTreeCache">
  </form>
  <!--以下是点击了某一个节点的Form-->

  <!-- 以下是删除本节点的窗口 -->
  <form method="post" name="DeletedNodeForm" action="node_delete.jsp">
       <input type="hidden" name="UgmConstantsDeletedNodeId" value="" />
		<input type="hidden" name="type" value="dict"/>
		<input type="hidden" name="root" value=""/>
  </form>


</BODY>
<script language="JavaScript">
	function resize() {
		dh=document.body.clientHeight;
		judgeDom();
	}
	var dh="";
	onresize=resize;
</script>
</HTML>
<%
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		if (dao != null) dao.disConnect();
	}
%>